export default {
  login: request => {
    //{"loginName":"admin","password":"123456"}
    const {username, loginName, password} = JSON.parse(request.body);
    if (password !== '123456') {
      return {code: 0, msg: "密码错误"};
    }
    return userMap[username] || userMap[loginName];
  },
  list: request => {
    return productMap;
  },
  logout: () => 'success'
};


const userMap = {
  admin: {
    code: 1,
    msg: "登录成功",
    data: require("./mockData/login"),
    dataList: [],
  },
  jiazk: {
    code: 0,
    msg: "用户名或密码错误",
    data: require("./mockData/login"),
    dataList: [],
  },
};

const productMap = {
  code: 1,
  msg: "登录成功",
  data: require("./mockData/login"),
};
